export default {
  // #ifdef MP-WEIXIN
  onShow() {
    // 确保右上角菜单出现“转发”和“分享到朋友圈”入口
    try {
      uni.showShareMenu({
        withShareTicket: true,
        menus: ['shareAppMessage', 'shareTimeline']
      })
    } catch (e) {}
  },
  onShareAppMessage() {
    const pages = getCurrentPages()
    const curr = pages[pages.length - 1]
    // 获取当前页面的完整路径及参数
    const url = `/${curr.route}${curr.options ? '?' + Object.keys(curr.options).map(k=>`${k}=${curr.options[k]}`).join('&') : ''}`
    return {
      title: '铭机数控·海量商机',
      path: url || '/pages/index/index'
    }
  },
  onShareTimeline() {
    const pages = getCurrentPages()
    const curr = pages[pages.length - 1]
    return {
      title: '铭机数控·海量商机',
      query: curr.options || {}
    }
  }
  // #endif
}
